package com.juntuo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.juntuo.entity.Cert;
import com.juntuo.entity.CertCdf;
import com.juntuo.mapper.CertCdfMapper;
import com.juntuo.mapper.CertMapper;
import com.juntuo.service.CdfCertService;
import com.juntuo.service.CertService;
import com.juntuo.service.helper.CommonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 简介：
 * 作者：Jason (chenxj@hadlinks.com)
 * 时间：2018/3/17 14:18
 */
@Service
public class CdfCertServiceImpl extends CommonServiceImpl<CertCdf> implements CdfCertService {
    @Autowired
    private CertCdfMapper certCdfMapper;


    @Override
    public PageInfo<Map<String, Object>> findPagedCertsByMainCertId(int pageNumber, int pageSize, Integer id, String number, Integer institution, Integer valid) {
        PageHelper.startPage(pageNumber,pageSize);
        List<Map<String,Object>> certs=certCdfMapper.getCdfCertsByMainCertId(id,number,institution,valid);
        PageInfo pageInfo= new PageInfo(certs);
        return pageInfo;
    }

    @Override
    public List<CertCdf> getPageCDFCerts(int pageNumber, int pageSize, String number,Integer institution) {

        PageHelper.startPage(pageNumber,pageSize);
        List<CertCdf> certs=certCdfMapper.getCdfCertsByNameAndCode(number,institution);
        return certs;
    }
}
